package net.vil.framework.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import net.vil.framework.page.Pager;
import net.villion.framework.jdbcorm.support.OrmJdbcPagerTemplate;

@Repository
public class MappingObjectServiceSupport implements MappingObjectService {

	@Autowired
	private OrmJdbcPagerTemplate ormJdbcPagerTemplate;
	
	@Override
	public <T> T insertMappingObject(T mo) {
		return ormJdbcPagerTemplate.insertObject(mo);
	}
	
	public <T extends Object> int[] insertBatchObject(List<T> list){
		return ormJdbcPagerTemplate.insertObject(list);
	}

	@Override
	public <T> T updateMappingObject(T mo) {
		return ormJdbcPagerTemplate.updateObjectByPK(mo);
	}

	@Override
	public <T> Pager<T> queryAllPagerList(Pager<T> pager, Class<T> cls) {
		return ormJdbcPagerTemplate.queryAllPagerList(pager, cls);
	}

	@Override
	public <T> void deleteMappingObject(T mo) {
		ormJdbcPagerTemplate.deleteObject(mo);
	}

	@Override
	public <T> T getMappingObjectByKey(T key) {
		return ormJdbcPagerTemplate.getObject(key);
	}

}
